// JavaScript部分
        document.addEventListener('DOMContentLoaded', function() {
            const slider = document.querySelector('.slider');
            const slides = document.querySelectorAll('.slide');
            const indicators = document.querySelectorAll('.indicator');
            let currentIndex = 0;
            const slideWidth = slides[0].clientWidth;
 
            function updateSlider() {
                slider.style.transform = `translateX(-${currentIndex * slideWidth}px)`;
                indicators.forEach((indicator, index) => {
                    indicator.classList.toggle('active', index === currentIndex);
                });
            }
 
            // 点击指示器切换
            indicators.forEach((indicator, index) => {
                indicator.addEventListener('click', () => {
                    currentIndex = index;
                    updateSlider();
                });
            });
 
            // 自动轮播（可选）
            let autoPlay = setInterval(() => {
                currentIndex = (currentIndex + 1) % slides.length;
                updateSlider();
            }, 3000);
 
            // 鼠标悬停时暂停自动轮播（可选）
            const sliderContainer = document.querySelector('.slider-container');
            sliderContainer.addEventListener('mouseenter', () => {
                clearInterval(autoPlay);
            });
 
            sliderContainer.addEventListener('mouseleave', () => {
                autoPlay = setInterval(() => {
                    currentIndex = (currentIndex + 1) % slides.length;
                    updateSlider();
                }, 3000);
            });
        });


// 登录界面
document.addEventListener('DOMContentLoaded', function() {
    const loginBtn = document.querySelector('.login-btn');
    const loginOverlay = document.getElementById('loginOverlay');
    const closeLoginBtn = document.getElementById('closeLogin');

    loginBtn.addEventListener('click', function() {
        loginOverlay.style.display = 'flex';
    });

    closeLoginBtn.addEventListener('click', function() {
        loginOverlay.style.display = 'none';
    });
});

// 产品卡片
document.addEventListener('DOMContentLoaded', function() {
    const productcards = document.querySelectorAll('.product-card');

    productcards.forEach(card => {
        card.addEventListener('click', function() {
            const url = this.getAttribute('data-url');
            if (url) {
                window.location.href = url;
            }
        });
    });
});